# Copyright 2023 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
load("//pw_build:compatibility.bzl", "incompatible_with_mcu")

package(default_visibility = ["//visibility:public"])

licenses(["notice"])

# TODO: b/298660977 - Add bazel support for CHRE.
filegroup(
    name = "chre",
    srcs = [
        "chre.cc",
        "chre_api_re.cc",
        "chre_empty_host_link.cc",
        "context.cc",
        "docs.rst",
        "example_init.cc",
        "host_link.cc",
        "include",
        "include/chre/target_platform/atomic_base.h",
        "include/chre/target_platform/atomic_base_impl.h",
        "include/chre/target_platform/condition_variable_base.h",
        "include/chre/target_platform/condition_variable_impl.h",
        "include/chre/target_platform/fatal_error.h",
        "include/chre/target_platform/host_link_base.h",
        "include/chre/target_platform/log.h",
        "include/chre/target_platform/memory_impl.h",
        "include/chre/target_platform/mutex_base.h",
        "include/chre/target_platform/mutex_base_impl.h",
        "include/chre/target_platform/platform_nanoapp_base.h",
        "include/chre/target_platform/platform_sensor_base.h",
        "include/chre/target_platform/platform_sensor_manager_base.h",
        "include/chre/target_platform/platform_sensor_type_helpers_base.h",
        "include/chre/target_platform/power_control_manager_base.h",
        "include/chre/target_platform/static_nanoapp_init.h",
        "include/chre/target_platform/system_timer_base.h",
        "memory.cc",
        "memory_manager.cc",
        "platform_debug_dump_manager.cc",
        "platform_nanoapp.cc",
        "platform_pal.cc",
        "power_control_manager.cc",
        "public",
        "public/pw_chre/chre.h",
        "public/pw_chre/host_link.h",
        "static_nanoapps.cc",
        "system_time.cc",
        "system_timer.cc",
    ],
)

filegroup(
    name = "doxygen",
    srcs = [
        "public/pw_chre/chre.h",
        "public/pw_chre/host_link.h",
    ],
)

sphinx_docs_library(
    name = "docs",
    srcs = [
        "docs.rst",
    ],
    prefix = "pw_chre/",
    target_compatible_with = incompatible_with_mcu(),
)
